<?php

namespace App\Http\Controllers;

use App\Common\Sql;

class DiamondsMall extends Base
{

    public function logic()
    {
        $row = Sql::select('t_diamonds_mall_conf', [['status',1]]);
        if (count($row) == 0) {
            return $this->returnError(1, '没有钻石商品');
        } else {
            $goods_arr = array();
            foreach ($row as $g) {
                $arr['id']       = (int)$g['id'];
                $arr['name']     = $g['name'];
                $arr['hot_flag'] = (int)$g['hot_flag'];
                $arr['rmb']      = (int)$g['rmb'];
                $arr['diamonds'] = (int)$g['diamonds'];
                //$arr['give_num'] = 0;
                $goods_arr[] = $arr;
            }
            return $this->returnData(array("diamonds_mall" => $goods_arr));
        }
    }

}
